class MyPageHeader extends BaseEditMaster {
    constructor(dataId, currentTaskPrivileges, nextTaskPrivileges, pageStatus, pageListData,
            returnUrl, fetchDataUrl, saveUrl, exportUrl, printUrl) {
        super(dataId, currentTaskPrivileges, nextTaskPrivileges, pageStatus, pageListData,
                returnUrl, fetchDataUrl, saveUrl, exportUrl, printUrl);
        this.$activeLi = null;
        this.checkUrl = "/master/material/check.html";
        this.uncheckUrl = "/master/material/uncheck.html";
    }
    OnPageLoad() {
        super.OnPageLoad();
        // 根据输入的供应商编号，设置相应的供应商信息
        $('#SupplierNo').keyup((event) => {
            if (parseInt(event.keyCode) === 13) {
                let index = $(":input").index(this);
                let _params = {};
                _params['SupplierNo'] = $.trim($('#SupplierNo').val());
                super.DoAjax(_params, "/master/supplier/fetchByNo.html", function (data, $self) {
                    $("#SupplierId").val(data.supplierId === null ? "" : data.supplierId);
                    $("#SupplierName").val(data.supplierName === null ? "" : data.supplierName);
                    // 焦点移动到下一个文本框
                    if (data.supplierId !== null) {
                        let newIndex = index + 1;
                        $(":input:eq(" + newIndex + ")").focus();
                    }
                });
            }
        });
        // 根据输入的计量单位代码，设置相应的计量单位
        $('#UomNo').keyup((event) => {
            if (parseInt(event.keyCode) === 13) {
                let index = $(":input").index(this);
                let _params = {};
                _params['UomNo'] = $.trim($('#UomNo').val());
                super.DoAjax(_params, "/master/uom/fetchByNo.html", function (data, $self) {
                    $("#UomId").val(data.uomId === null ? "" : data.uomId);
                    $("#UomName").val(data.uomName === null ? "" : data.uomName);
                    // 焦点移动到下一个文本框
                    if (data.uomId !== null) {
                        let newIndex = index + 1;
                        $(":input:eq(" + newIndex + ")").focus();
                    }
                });
            }
        });
    }
    // 得到材料信息数据
    GetEntityData() {
        let item = {};
        item['materialId'] = $("#HeaderId").val();
        item['materialCode'] = formatNullInputValue($.trim($("#MaterialCode").val()));
        item['materialName'] = formatNullInputValue($.trim($("#MaterialName").val()));
        item['mnemonicCode'] = formatNullInputValue($.trim($("#MnemonicCode").val()));
        item['materialShortName'] = formatNullInputValue($.trim($("#MaterialShortName").val()));
        item['uomId'] = $.trim($("#UomId").val());
        item['colourNumber'] = formatNullInputValue($.trim($("#ColourNumber").val()));
        item['colourName'] = formatNullInputValue($.trim($("#ColourName").val()));
        item['unitPrice'] = formatNullInputValue($.trim($("#UnitPrice").val()));
        item['materialComposition'] = formatNullInputValue($.trim($("#MaterialComposition").val()));
        item['qualityStandard'] = formatNullInputValue($.trim($("#QualityStandard").val()));
        item['supplierId'] = $.trim($("#SupplierId").val());
        item['specification'] = formatNullInputValue($.trim($("#Specification").val()));
        item['yarnCount'] = formatNullInputValue($.trim($("#YarnCount").val()));
        item['fabricWidth'] = formatNullInputValue($.trim($("#FabricWidth").val()));
        item['gramWeight'] = formatNullInputValue($.trim($("#GramWeight").val()));
        item['sparedQuantity'] = formatNullInputValue($.trim($("#SparedQuantity").val()));
        item['fabricMinimumLot'] = formatNullInputValue($.trim($("#FabricMinimumLot").val()));
        item['dyeingMinimumLot'] = formatNullInputValue($.trim($("#DyeingMinimumLot").val()));
        item['minimumStock'] = formatNullInputValue($.trim($("#MinimumStock").val()));
        item['maximumStock'] = formatNullInputValue($.trim($("#MaximumStock").val()));
        item['safetyStock'] = formatNullInputValue($.trim($("#SafetyStock").val()));
        item['coefficient'] = formatNullInputValue($.trim($("#Coefficient").val()));
        item['dyingSubCharge'] = formatNullInputValue($.trim($("#DyingSubCharge").val()));
        item['meshBeltOpening'] = formatNullInputValue($.trim($("#MeshBeltOpening").val()));
        item['toleranceTypeId'] = formatNullInputValue($.trim($("#ToleranceTypeId").val()));   // 允许限制标准（即材料订货损耗及到货允许类型）
        item['materialSourceTypeId'] = $("#MaterialSourceTypeId").val();    // 物料来源
        item['materialFlag'] = formatNullInputValue($.trim($("#MaterialFlag").val()));
        item['catalogueId'] = formatNullInputValue($.trim($("#CatalogueId").val()));
        item['description'] = formatNullInputValue($.trim($("#Description").val()));
        item['ceatedBy'] = parseInt($.trim($("#UserId").val()));
        item['updatedBy'] = parseInt($.trim($("#UserId").val()));

        return JSON.stringify(item);
    }
    FillData(data) {
        let item = data.MaterialEntity;
        $("#HeaderId").val(item.materialId);
        $("#MaterialCode").val(item.materialCode);
        $("#MaterialName").val(item.materialName);
        $("#MnemonicCode").val(item.mnemonicCode);
        $("#MaterialShortName").val(item.materialShortName);
        $("#UomId").val(item.uomId);
        $("#UomNo").val(item.uomNo);
        $("#UomName").val(item.uomName);
        $("#ColourNumber").val(item.colourNumber);
        $("#ColourName").val(item.colourName);
        //if (item.isSupplierGroupMember > 0) {
        $("#UnitPrice").val(item.unitPrice);
        //} else {
        //    $("#UnitPrice").val();
        //    $("#UnitPrice").attr("readonly", "readonly");
        //}
        $("#MaterialComposition").val(item.materialComposition);
        $("#QualityStandard").val(item.qualityStandard);
        $("#SupplierId").val(item.supplierId);
        //if (parseInt(item.isSupplierGroupMember) > 0) {
        $("#SupplierNo").removeAttr("readonly");
        $("#SupplierNo").val(item.supplierNo);
        $("#SupplierName").val(item.supplierName);
        $("#ChoiceSupplier").bind("click", function () {
            this.DoChoiceSupplier();
        });
        //} else {
        //    $("#SupplierNo").val("");
        //    $("#SupplierName").val("");
        //    $("#SupplierNo").attr("readonly", "readonly");
        //    $("#ChoiceSupplier").unbind("click");
        //}
        $("#Specification").val(item.specification);
        $("#YarnCount").val(item.yarnCount);
        $("#FabricWidth").val(item.fabricWidth);
        $("#GramWeight").val(item.gramWeight);
        $("#SparedQuantity").val(item.sparedQuantity);
        $("#FabricMinimumLot").val(item.fabricMinimumLot);
        $("#DyeingMinimumLot").val(item.dyeingMinimumLot);
        $("#MinimumStock").val(item.minimumStock);
        $("#MaximumStock").val(item.maximumStock);
        $("#SafetyStock").val(item.safetyStock);
        $("#Coefficient").val(item.coefficient);
        $("#DyingSubCharge").val(item.dyingSubCharge);
        $("#MeshBeltOpening").val(item.meshBeltOpening);
        $("#ToleranceTypeId").val(item.toleranceTypeId);
        $("#ToleranceTypeName").val(item.toleranceTypeName);
        $("#MaterialSourceTypeId").val(item.materialSourceTypeId);
        $("#MaterialFlag").val(item.materialFlag);
        $("#CatalogueId").val(item.catalogueId);
        $("#CatalogueName").val(item.catalogueName);
        $("#Description").val(item.description);
        // 设置当前目录
        $("#NodeId").val(item.catalogueId);
        $("#NodeText").val(item.catalogueName);
        $("#UpdatedByName").val(item.updatedByName);
        $("#UpdatedDate").val(item.updatedDate === null ? '' : item.updatedDate);
        // 最后的审核人、审核日期
        $("#CheckedBy").val(item.checkedBy);
        $("#CheckedByName").val(item.checkedByName);
        $("#CheckedDate").val(item.checkedDate === null ? '' : item.checkedDate);
        $("#CheckedStatus").val(item.checkedStatus);
        $('#FlowOrderNo').val(item.flowOrderNo);

        // 设置交付日期
        this.scheduleNode = data.ScheduleNode;

        // 显示明细数据
        _InstancePageGroup.BuildDataTable(data.MaterialGroupList);
        // 显示图片
        $("#material_pic_list").empty();
        let _picList = data.MaterialPictureList;
        if (_picList.length > 0) {
            let content = '';
            for (let i = 0; i < _picList.length; i++) {
                content += '<li id="' + _picList[i].linesId + '" imageFileDir="' + _picList[i].imageFileDir + '" imageFileName="' + _picList[i].imageFileName + '">';
                content += '<img src="' + $("#PictureUrl").val() + "/" + _picList[i].imageUrl + '" alt="材料图片" style="max-width:142px; max-height:110px;" />';
                content += '</li>';
                $("#material_pic_list").append(content);
                content = '';
            }
            _InstancePagePicture.OnClickPicture();
        }

        this.currentTaskPrivileges = item.currentTaskPrivileges;
        this.nextTaskPrivileges = item.nextTaskPrivileges;
        this.unCheckFlag = item.unCheckFlag;

        this.SetPageElementStatus(this.HidePageElement, this.ShowPageElement, function () {
            _InstancePageGroup.AutoAdjustTableHeightForLines();
        });
        $("#SupplierNo").focus();
    }
    Save(flag) {
        super.Save(function (data, $self) {
            if (data > 0) {
                if (parseInt($self.pageStatus) === 1) {
                    $("#HeaderId").val(data);   // 设置刚才插入的记录ID
                    $self.dataId = data;
                    $self.pageStatus = 2;
                }
                $("#menu_02").show();
                $("#menu_03").show();

                if (flag === 0) {
                    $self.New();
                }
            }
        });
    }
    OnNew() {
        let item = this.HoldEntityData();
        // 默认设置一些值
        $('#HeaderId').val("0");
        $("#SupplierId").val("");
        $("#SupplierNo").removeAttr("readonly");
        $("#menu_02").hide();
        $("#menu_03").hide();
        $("#menu_04").hide();
        // 清空分组及日志
        $("#tabData01 tbody").empty();
        $("#tabData02 tbody").empty();
        // 清空材料图片
        $("#material_pic_list").empty();

        //自适应高度
        //SetSlaveTableHeight();
        $("#SupplierNo").focus();

        super.OnNew();

        // 初始化所属材料分类
        $('#CatalogueId').val($("#NodeId").val());
        $('#CatalogueName').val($("#NodeText").val());
        // 保留刚才画面的内容
        this.PasteEntityData(item);
    }
    // 保留当前录入内容，避免重复录入
    HoldEntityData() {
        let item = {};

        item['uomId'] = $.trim($("#UomId").val());
        item['uomName'] = $.trim($("#UomName").val());
        item['uomNo'] = $.trim($("#UomNo").val());
        item['colourNumber'] = $.trim($("#ColourNumber").val());
        item['colourName'] = $.trim($("#ColourName").val());
        item['unitPrice'] = $.trim($("#UnitPrice").val());
        item['materialComposition'] = $.trim($("#MaterialComposition").val());
        item['qualityStandard'] = $.trim($("#QualityStandard").val());
        item['supplierId'] = $.trim($("#SupplierId").val());
        item['supplierName'] = $.trim($("#SupplierName").val());
        item['supplierNo'] = $.trim($("#SupplierNo").val());
        item['specification'] = $.trim($("#Specification").val());
        item['yarnCount'] = $.trim($("#YarnCount").val());
        item['fabricWidth'] = $.trim($("#FabricWidth").val());
        item['gramWeight'] = $.trim($("#GramWeight").val());
        item['sparedQuantity'] = $.trim($("#SparedQuantity").val());
        item['fabricMinimumLot'] = $.trim($("#FabricMinimumLot").val());
        item['dyeingMinimumLot'] = $.trim($("#DyeingMinimumLot").val());
        item['minimumStock'] = $.trim($("#MinimumStock").val());
        item['maximumStock'] = $.trim($("#MaximumStock").val());
        item['safetyStock'] = $.trim($("#SafetyStock").val());
        item['coefficient'] = $.trim($("#Coefficient").val());
        item['dyingSubCharge'] = $.trim($("#DyingSubCharge").val());
        item['meshBeltOpening'] = $.trim($("#MeshBeltOpening").val());
        item['toleranceTypeId'] = $.trim($("#ToleranceTypeId").val());                // 材料定损
        item['toleranceTypeName'] = $.trim($("#ToleranceTypeName").val());
        item['materialSourceTypeId'] = $.trim($("#MaterialSourceTypeId").val());      // 材料来源
        item['materialSourceTypeName'] = $.trim($("#MaterialSourceTypeName").val());
        item['materialFlag'] = $.trim($("#MaterialFlag").val());
        item['description'] = $.trim($("#Description").val());

        return item;
    }
    PasteEntityData(item) {
        $("#UomId").val(item['uomId']);
        $("#UomName").val(item['uomName']);
        $("#UomNo").val(item['uomNo']);
        $("#ColourNumber").val(item['colourNumber']);
        $("#ColourName").val(item['colourName']);
        $("#UnitPrice").val(item['unitPrice']);
        $("#MaterialComposition").val(item['materialComposition']);
        $("#QualityStandard").val(item['qualityStandard']);
        $("#SupplierId").val(item['supplierId']);
        $("#SupplierName").val(item['supplierName']);
        $("#SupplierNo").val(item['supplierNo']);
        $("#Specification").val(item['specification']);
        $("#YarnCount").val(item['yarnCount']);
        $("#FabricWidth").val(item['fabricWidth']);
        $("#GramWeight").val(item['gramWeight']);
        $("#SparedQuantity").val(item['sparedQuantity']);
        $("#FabricMinimumLot").val(item['fabricMinimumLot']);
        $("#DyeingMinimumLot").val(item['dyeingMinimumLot']);
        $("#MinimumStock").val(item['minimumStock']);
        $("#MaximumStock").val(item['maximumStock']);
        $("#SafetyStock").val(item['safetyStock']);
        $("#Coefficient").val(item['coefficient']);
        $("#DyingSubCharge").val(item['dyingSubCharge']);
        $("#MeshBeltOpening").val(item['meshBeltOpening']);
        $("#ToleranceTypeId").val(item['toleranceTypeId']);                  // 材料定损
        $("#ToleranceTypeName").val(item['toleranceTypeName']);
        $("#MaterialSourceTypeId").val(item['materialSourceTypeId']);        // 材料来源
        $("#MaterialFlag").val(item['materialFlag']);
        $("#Description").val(item['description']);
    }
    DoChoiceSupplier() {
        let _choice = new CommonChoice();
        let params = {};
        params['Flag'] = 0;
        params['CurrentUserId'] = null;
        params['NotInGroupId'] = null;
        _choice.DoChoiceSupplier(params, '选择供应商', (data) => {
            if (data) {
                // 判断是否数据发生了改变如果改变则设置改变标记
                if ($("#SupplierNo").val() !== data[2]) {
                    $("#form_data").data("changed", true);
                }
                $("#SupplierId").val(data[0]);
                $("#SupplierName").val(data[1]);
                $("#SupplierNo").val(data[4]);
                $("#SupplierName").focus();
            }
        });
    }
    DoChoiceUom() {
        let _choice = new CommonChoice();
        _choice.DoChoiceUom(0, '选择计量单位', (data) => {
            if (data) {
                // 判断是否数据发生了改变如果改变则设置改变标记
                if ($("#UomNo").val() !== data[2]) {
                    $("#form_data").data("changed", true);
                }
                $("#UomId").val(data[0]);
                $("#UomName").val(data[1]);
                $("#UomNo").val(data[2]);
                $("#UomName").focus();
            }
        });
    }
    DoChoiceToleranceType() {
        let _choice = new CommonChoice();
        _choice.DoChoiceToleranceType(0, '选择材料订货损耗及到货允许类型', (data) => {
            if (data) {
                // 判断是否数据发生了改变如果改变则设置改变标记
                if ($("#ToleranceTypeName").val() !== data[1]) {
                    $("#form_data").data("changed", true);
                }
                $("#ToleranceTypeId").val(data[0]);
                $("#ToleranceTypeName").val(data[1]);
                $("#ToleranceTypeName").focus();
            }
        });
    }
    DoChoiceCatalogue() {
        let _choice = new CommonChoice();
        _choice.DoChoiceCatalogue('/master/material/catalogue/choice.html', '选择所属材料目录', (data) => {
            if (data) {
                // 判断是否数据发生了改变如果改变则设置改变标记
                if ($("#CatalogueName").val() !== data[1]) {
                    $("#form_data").data("changed", true);
                }
                $("#CatalogueId").val(data[0]);
                $("#CatalogueName").val(data[1]);
                $("#CatalogueName").focus();
            }
        });
    }
    DoCheck() {
        super.DoCheck(function (data, $self) {
            // 设置画面各个元素状态
            $self.SetPageElementStatus($self.HidePageElement, $self.ShowPageElement, function () {
                _InstancePageGroup.AutoAdjustTableHeightForLines();
            });
            if (data.MaterialGroupList !== undefined) {
                _InstancePageGroup.BuildDataTable(data.MaterialGroupList);
            }
        });
    }
    Uncheck() {
        super.Uncheck(function (data, $self) {
            // 设置画面各个元素状态
            $self.SetPageElementStatus($self.HidePageElement, $self.ShowPageElement, function () {
                _InstancePageGroup.AutoAdjustTableHeightForLines();
            });
            if (data.MaterialGroupList !== undefined) {
                _InstancePageGroup.BuildDataTable(data.MaterialGroupList);
            }
        });
    }
    ShowPageElement(data, _this) {
        $("#ButSave").show();
        $("#ButDelPicture").show();
        $("#hzUploadFile").attr("disabled", false);
        $("#btnPanel03").show();
        $("#div03").css({"top": "0px"});
    }
    HidePageElement(data, _this) {
        //$("#ButSave").hide();
        //$("#ButDelPicture").hide();
        //$("#hzUploadFile").attr("disabled", true);
        //$("#btnPanel03").hide();
        //$("#div03").css({"top": "10px"});
    }
}

class MyPagePicture extends BaseEditPicture {
    constructor() {
        super();
        this.saveUrl = "/master/material/picture/save.html";
        this.delUrl = "/master/material/picture/delete.html";
        this.fileId = $("#HeaderId").val();
        this.$picList = $("#material_pic_list");
        this.altStr = "材料图片";
    }
}

class MyPageGroup extends BaseEditSlave {
    constructor() {
        super('', '', '');
    }
    BuildDataTable(result) {
        $("#tabData01 tbody").empty();
        // 得到数据列表      
        if (result === null) {
            this.rows = 0;
            return false;
        }
        let content = '';
        this.rows = result.length;
        for (let i = 0; i < result.length; i++) {
            let id = result[i].groupId;
            let sequence = i + 1;
            content += '<tr _mash_id="' + id + '">';
            content += '<td style="text-align:center;">' + sequence + '</td>';   // 序号
            if ($("#CheckedByName").val() === "") {
                content += '<td class="column__action"><span title="删除" class="trash" onclick="_InstancePageGroup.DeleteLines($(this));"><i class="fa-all fa-trash-o fa-1"></i></span></td>';
            } else {
                content += '<td></td>';
            }
            content += '<td>' + formatNullData(result[i].groupNo) + '</td>';     // 编号
            content += '<td>' + formatNullData(result[i].groupName) + '</td>';   // 名称
            content += '<td>' + formatNullData(result[i].description) + '</td>';
            content += '</tr>';
            $("#tabData01 tbody").append(content);
            content = '';
        }
        setOneTableRowColor("tabData01");
    }
    // 删除材料组操作
    DeleteLines($self) {
        let params = {};
        params['MaterialNo'] = $("#MaterialCode").val();
        params['GroupName'] = $self.parent().parent().find("td").eq(3).text();
        params['GroupId'] = $self.parent().parent().attr("_mash_id");
        params['MaterialId'] = parseInt($("#HeaderId").val());
        params['DeletedBy'] = parent.$("#UserId").val();

        super.DeleteLines(params, "/master/material_in_group/delete.html", function (data, $self) {
            if (data !== null) {
                // 显示明细数据
                $self.BuildDataTable(data);
            }
            ShowSuccessMessagePanel('删除成功。');
        });
    }
    AddMaterialIntoGroup() {
        let _choice = new CommonChoice();
        _choice.DoChoiceMaterialGroup(1, '选择材料分组', (data) => {
            let itemList = [];
            for (let i = 0; i < data.length; i++) {
                let item = {};
                item['materialNo'] = $("#MaterialCode").val();
                item['groupId'] = data[i].groupId;
                item['materialId'] = parseInt($("#HeaderId").val());
                item['createdBy'] = parseInt($.trim(parent.$("#UserId").val()));
                item['updatedBy'] = parseInt($.trim(parent.$("#UserId").val()));

                itemList.push(item);
            }
            // 保存，根据所选材料组和材料，增加明细表记录
            super.DoAjax(itemList, "/master/material_in_group/insert.html", function (data, $self) {
                if (data.Success) {
                    $self.BuildDataTable(data.LinesList);
                    ShowSuccessMessagePanel('材料分组设置成功。');
                }
            });
        });
    }
    AutoAdjustTableHeightForLines() {
        let h = $(window).height();
        let _tabTop = $("#div03").offset().top + 26;   // 用于随着窗口变化，下面明细高度随之变化的一个节点
        let _rc = Math.floor((h - _tabTop - 25) / 25);
        let _dh = _rc * 25 + 17;
        let _rowH = this.rows * 25 + 17; // 计算行高
        _dh = (_rowH >= _dh) ? _dh : _rowH;

        $("#divContent").css({"max-height": _dh - 1, height: _dh - 1});
    }
}

var _InstancePageHeader = null;
var _InstancePagePicture = null;
var _InstancePageGroup = null;

//-----------------------------------------------------------------------------
// 页面初始化
//-----------------------------------------------------------------------------
function onPageReady() {
    let _pageStatus = $("#Action").val();
    let _dataId = $("#HeaderId").val();

    let material_list_result = $.cookie("material_list_result") === undefined ? "" : $.cookie("material_list_result");
    let _pageListData = [];
    if (material_list_result !== "") {
        _pageListData = material_list_result.split(',');
        $("#rec_total_rows").text(_pageListData.length);
        $("#rec_cur_row").text($.inArray(_dataId, _pageListData) + 1);

        if (_pageListData.length > 0) {
            let index = $.inArray(_dataId, _pageListData);
            if (index === 0) {
                $("#ButPrev").attr("disabled", "disabled");
            } else {
                $("#ButNext").removeAttr("disabled");
            }
            if (index === (_pageListData.length - 1)) {
                $("#ButNext").attr("disabled", "disabled");
            } else {
                $("#ButPrev").removeAttr("disabled");
            }
        }
    } else {
        $("#rec_total_rows").text("1");
        $("#rec_cur_row").text("1");
    }

    _InstancePageHeader = new MyPageHeader(_dataId, 0, 0, _pageStatus, _pageListData,
            "/master/material/list.html",
            "/master/material/fetchByKey.html",
            "/master/material/save.html",
            "/master/material/export.html",
            "/master/material/print.html");

    _InstancePageGroup = new MyPageGroup();
    _InstancePagePicture = new MyPagePicture();

    $("#tabPanelHeader").wxTabs({tabContent: "tabPanelContent"});

    _InstancePageHeader.OnPageLoad();
}

// 画面大小或者位置移动
function onPageResize() {
    let w = $(window).width();
    $(".data__table_wrapper").css({width: w - 40});
}

//-----------------------------------------------------------------------------
// 验证函数
//-----------------------------------------------------------------------------
$.validator.setDefaults({
    ignore: 'hidden, [reaonly=readonly]'
});
$.validator.addMethod("valueNotEquals", function (value, element, arg) {
    return arg !== value;
}, "Value must not equal arg.");

$(function () {
    $("#form_data").validate({
        // Step 1：设置验证规则和错误消息
        rules: {
            _MaterialCode: "required",
            _MaterialName: "required",
            _UomName: "required",
            _SupplierName: "required",
            //_ToleranceTypeName: "required",
            _MaterialSourceTypeId: {
                valueNotEquals: "-1",
                required: true
            },
            _MaterialFlag: {
                valueNotEquals: "-1",
                required: true
            }
        },
        messages: {
            _MaterialCode: "请填写材料编号。",
            _MaterialName: "请填写材料名称。",
            _UomName: "请填写计量单位。",
            _SupplierName: "请填写供应商。",
            //_ToleranceTypeName: "请填写订货损耗及到货允许类型。",
            _MaterialSourceTypeId: {
                valueNotEquals: "请选择材料来源。",
                required: "请选择材料来源。"
            },
            _MaterialFlag: {
                valueNotEquals: "请选择材料类型。",
                required: "请选择材料类型。"
            }
        },
        // Step 2：设置验证触发事件
        onclick: false,
        onfocusout: false,
        onfocusin: false,
        onkeyup: false,
        onkeydown: false,
        focusInvalid: false,
        // Step 3：设置错误信息提示
        showErrors: window.showErrors  //使用自定义的错误显示方法
    });
});
